Use generic pointers for constraint targets
authorEmmanuele Bassi <ebassi@gnome.org>
Thu, 27 Jun 2019 17:26:19 +0000 (18:26 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Sun, 30 Jun 2019 22:42:44 +0000 (23:42 +0100)
Since GtkWidget implements GtkConstraintTarget, we can omit the explicit
cast, and validate the type at run time.

gtk/gtkconstraint.c
gtk/gtkconstraint.h

index 98a6afab2bb4b90282017ade8a21c18beffdb9a7..6c20c48b948e62b6c536044775c56fca1ebe5f72 100644 (file)
@@ -315,11 +315,11 @@ gtk_constraint_init (GtkConstraint *self)
 
 /**
  * gtk_constraint_new:
- * @target: (nullable): a #GtkConstraintTarget
- * @target_attribute: the attribute of @target_widget to be set
+ * @target: (nullable) (type GtkConstraintTarget): a #GtkConstraintTarget
+ * @target_attribute: the attribute of @target to be set
  * @relation: the relation equivalence between @target_attribute and @source_attribute
- * @source: (nullable): a #GtkConstraintTarget
- * @source_attribute: the attribute of @source_widget to be read
+ * @source: (nullable) (type GtkConstraintTarget): a #GtkConstraintTarget
+ * @source_attribute: the attribute of @source to be read
  * @multiplier: a multiplication factor to be applied to @source_attribute
  * @constant: a constant factor to be added to @source_attribute
  * @strength: the strength of the constraint
@@ -330,10 +330,10 @@ gtk_constraint_init (GtkConstraint *self)
  * Returns: the newly created #GtkConstraint
  */
 GtkConstraint *
-gtk_constraint_new (GtkConstraintTarget    *target,
+gtk_constraint_new (gpointer                target,
                     GtkConstraintAttribute  target_attribute,
                     GtkConstraintRelation   relation,
-                    GtkConstraintTarget    *source,
+                    gpointer                source,
                     GtkConstraintAttribute  source_attribute,
                     double                  multiplier,
                     double                  constant,
@@ -356,8 +356,8 @@ gtk_constraint_new (GtkConstraintTarget    *target,
 
 /**
  * gtk_constraint_new_constant:
- * @target: (nullable): a #GtkConstraintTarget
- * @target_attribute: the attribute of @target_widget to be set
+ * @target: (nullable) (type GtkConstraintTarget): a #GtkConstraintTarget
+ * @target_attribute: the attribute of @target to be set
  * @relation: the relation equivalence between @target_attribute and @constant
  * @constant: a constant factor to be set on @target_attribute
  * @strength: the strength of the constraint
@@ -368,7 +368,7 @@ gtk_constraint_new (GtkConstraintTarget    *target,
  * Returns: the newly created #GtkConstraint
  */
 GtkConstraint *
-gtk_constraint_new_constant (GtkConstraintTarget    *target,
+gtk_constraint_new_constant (gpointer                target,
                              GtkConstraintAttribute  target_attribute,
                              GtkConstraintRelation   relation,
                              double                  constant,
index 320795b0e7ed090d00e6b6a103cb79999729cce1..6d1d7be1a6f87f68e08d7c4b731aad8f25f537a5 100644 (file)
@@ -58,16 +58,16 @@ GDK_AVAILABLE_IN_ALL
 G_DECLARE_FINAL_TYPE (GtkConstraint, gtk_constraint, GTK, CONSTRAINT, GObject)
 
 GDK_AVAILABLE_IN_ALL
-GtkConstraint *         gtk_constraint_new                      (GtkConstraintTarget    *target_widget,
+GtkConstraint *         gtk_constraint_new                      (gpointer                target,
                                                                  GtkConstraintAttribute  target_attribute,
                                                                  GtkConstraintRelation   relation,
-                                                                 GtkConstraintTarget    *source_widget,
+                                                                 gpointer                source,
                                                                  GtkConstraintAttribute  source_attribute,
                                                                  double                  multiplier,
                                                                  double                  constant,
                                                                  int                     strength);
 GDK_AVAILABLE_IN_ALL
-GtkConstraint *         gtk_constraint_new_constant             (GtkConstraintTarget    *target_widget,
+GtkConstraint *         gtk_constraint_new_constant             (gpointer                target,
                                                                  GtkConstraintAttribute  target_attribute,
                                                                  GtkConstraintRelation   relation,
                                                                  double                  constant,